Skip to content

test: refactor test_data_color_utils.py through parametrization#740

Merged
rich-iannone merged 10 commits into
posit-dev:mainfrom
FBruzzesi:test/refactor-data-color-utils
May 19, 2026
Merged

test: refactor test_data_color_utils.py through parametrization#740
rich-iannone merged 10 commits into
posit-dev:mainfrom
FBruzzesi:test/refactor-data-color-utils

Conversation

@FBruzzesi
Copy link
Copy Markdown
Contributor

Summary

As per title: this PR aims to refactor test_data_color_utils by exploiting pytest parametrization.

On top of it, it sets up the stage for a dataframe constructor fixture to be used elsewhere (e.g. follow up on test_data_color.py to test with all backends)

Checklist

Comment thread great_tables/_tbl_data.py

arr = pa.array([x])
return arr.is_null().to_pylist()[0] or arr.is_nan().to_pylist()[0]
return arr.is_null(nan_is_null=True).to_pylist()[0]
Copy link
Copy Markdown
Contributor Author

@FBruzzesi FBruzzesi Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for this change is that .is_nan raises an exception for non-numeric arrays. It was not tested for pyarrow before

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.02%. Comparing base (2c53a90) to head (d38b885).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #740      +/-   ##
==========================================
+ Coverage   93.00%   93.02%   +0.01%     
==========================================
  Files          48       48              
  Lines        6379     6379              
==========================================
+ Hits         5933     5934       +1     
+ Misses        446      445       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@machow
Copy link
Copy Markdown
Collaborator

machow commented Jul 31, 2025

@rich-iannone do you mind reviewing this?

Comment thread great_tables/_tbl_data.py Outdated
Comment on lines +32 to +35
PdSeries = pd.Series
PdSeries = pd.Series[Any]
PlSeries = pl.Series
PyArrowArray = pa.Array
PyArrowChunkedArray = pa.ChunkedArray
PyArrowArray = pa.Array[Any]
PyArrowChunkedArray = pa.ChunkedArray[Any]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for this is that I was getting warnings that

SeriesLike is partially unknown

Comment thread tests/conftest.py Outdated
Copy link
Copy Markdown
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@rich-iannone rich-iannone merged commit 94ab7c9 into posit-dev:main May 19, 2026
14 checks passed
@FBruzzesi FBruzzesi deleted the test/refactor-data-color-utils branch May 19, 2026 21:29
@FBruzzesi
Copy link
Copy Markdown
Contributor Author

Thanks @rich-iannone 🙏

@rich-iannone
Copy link
Copy Markdown
Member

Really sorry this took so long, but I do appreciate the continued support!

@FBruzzesi
Copy link
Copy Markdown
Contributor Author

Really sorry this took so long, but I do appreciate the continued support!

Nothing to be sorry about! Happy to contribute to the project 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants